package model

import "encoding/json"

type LogEntry struct {
	Tag       int
	Term      int64
	Index     int64
	PrevTerm  int64
	PrevIndex int64
	Command   []byte
}

func (me *LogEntry) Marshal() (error, []byte) {
	j, e := json.Marshal(me)
	if e != nil {
		return e, nil
	}
	return nil, j
}

func (me *LogEntry) Unmarshal(data []byte) error {
	return json.Unmarshal(data, me)
}
